#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QDebug>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QEventLoop>
#include <QSslSocket>
#include <QStringList>
#include <QTimer>

#define cout qDebug()<<__FILE__<<"/"<<__LINE__<<":"

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    struct GloAlmSVParaTrans
    {
        unsigned char M;    //01
        unsigned char n;    //NS
        unsigned char H;    //nl
        unsigned char l;    //可以填0
        unsigned char Cn;   //可以填1
        double tau;         //δt2
        double lambda;      //LΩ
        double delta_i;     //i-63
        double epsilon;     //e
        double omega;       //ω
        double t;           //TΩ
        double delta_T;     //Trev-43200
        double delta_T_dot; //ΔT
    };

private slots:
    void TimerGetGloAlm();

private:
    void DecodeAlm(const QByteArray &data);
    //网页地址
    const QString URLSTR = "https://www.glonass-iac.ru/en/GLONASS/ephemeris.php";
    //获取网页代码
    QNetworkAccessManager manager;
    QEventLoop loop;
    QNetworkReply *reply;
    GloAlmSVParaTrans almanac[24];
    QTimer *timer;


};
#endif // MAINWINDOW_H
